<template>
  <div class="contains">
    <div class="screen" ref="box">
      <div class="top">
        <Top1></Top1>
      </div>
      <div class="bottom">
        <div class="left">
          <WaterBall class="waterBall"></WaterBall>
          <Sex class="sex"></Sex>
          <Age class="age"></Age>
        </div>
        <div class="right">
          <China></China>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import WaterBall from './bottom/left/waterBall.vue'
import Sex from './bottom/left/sex.vue'
import Age from './bottom/left/age.vue'
import China from './bottom/right/china.vue'

import Top1 from './top/index.vue'
import { onMounted, ref } from 'vue'
let box = ref()
onMounted(() => {
  box.value.style.transform = `scale(${getScal()}) translate(-50%,-50%)`
})
const getScal = (w = 1920, h = 1080) => {
  let ww = window.innerWidth / w
  let hh = window.innerHeight / h
  return ww < hh ? ww : hh
}
window.addEventListener('resize', function () {
  // 处理窗口大小变化的代码
  box.value.style.transform = `scale(${getScal()}) translate(-50%,-50%)`
})
</script>
<style scoped lang="scss">
.contains {
  width: 100vw;
  height: 100vh;
  background: url(./images/bg.png) no-repeat;
  background-size: 100% 100%;

  .screen {
    width: 1920px;
    height: 1080px;
    position: fixed;
    left: 50%;
    top: 50%;
    transform-origin: left top;

    .top {
      width: 100%;
      height: 60px;
    }

    .bottom {
      width: 100%;
      height: 1020px;
      display: flex;
      .left {
        margin-left: 63px;
        width: 500px;
        height: 1020px;
        display: flex;
        flex-direction: column;
        .waterBall {
          flex: 1;
        }

        .sex {
          flex: 1;
        }

        .age {
          flex: 1;
        }
      }
      .right {
        width: 1294px;
        height: 1020px;
        margin-right: 63px;
      }
    }
  }
}
</style>
